#version 150

#moj_import <fog.glsl>

uniform sampler2D Sampler0;
uniform sampler2D Sampler2;

uniform vec4 ColorModulator;
uniform float FogStart;
uniform float FogEnd;
uniform vec4 FogColor;
uniform float GameTime;

in float vertexDistance;
in vec4 vertexColor;
in vec2 texCoord0;
in vec4 ColorShader;

out vec4 fragColor;

void main() {
    vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
    if (color.a < 0.1) {
        discard;
    }
    if (color.rgb == vec3(114.0/255.0,51.0/255.0,4.0/255.0)){
        color.rgb = vec3(abs(sin(GameTime*1200 + vertexDistance/2 + 1)),abs(sin(GameTime*1200 + vertexDistance/2)),abs(sin(GameTime*1200 + vertexDistance/2 - 1)));
    }
    if (color.rgb == vec3(114.0/255.0,51.0/255.0,3.0/255.0)){
        color.rgb = vec3(0.3+abs(0.6-sin(GameTime*1200 + vertexDistance/2 + 1)),0.3+abs(0.6-sin(GameTime*1200 + vertexDistance/2)),0.3+abs(0.6-sin(GameTime*1200 + vertexDistance/2 - 1)));
    }
    fragColor = linear_fog(color * ColorShader, vertexDistance, FogStart, FogEnd, FogColor);
}
